public class Code4 {
    public static void main(String[] args) {
        // 定义商品1的相关变量
        String brand1 = "MacBookAir";
        double size1 = 13.3;
        double price1 = 5699.0;
        int stock1 = 5;

        // 定义商品2的相关变量
        String brand2 = "ThinkPadT490";
        double size2 = 14.0;
        double price2 = 8499.0;
        int stock2 = 10;

        // 定义商品3的相关变量
        String brand3 = "MateBook";
        double size3 = 14.0;
        double price3 = 7199.0;
        int stock3 = 18;

        // 输出表头
        System.out.println("品牌\t型号\t尺寸\t价格\t库存数");

        // 输出表格中间部分
        System.out.println(brand1 + "\t\t" + size1 + "\t" + price1 + "\t" + stock1);
        System.out.println(brand2 + "\t" + size2 + "\t" + price2 + "\t" + stock2);
        System.out.println(brand3 + "\t\t" + size3 + "\t" + price3 + "\t" + stock3);

        // 计算总库存数
        int totalStock = stock1 + stock2 + stock3;
        // 计算商品库存总金额
        double totalAmount = price1 * stock1 + price2 * stock2 + price3 * stock3;

        // 输出表格尾部
        System.out.println("总库存数：" + totalStock);
        System.out.println("商品库存总金额：" + totalAmount);
    }
}
